import request from '@/utils/request';
import type { FormGoodsType } from './components/data';

export async function getGoodsList(params) {
  return request('/api/v1/goods/getList', {
    method: 'GET',
    params,
  });
}
export async function createGoods(params: FormGoodsType) {
  return request('/api/v1/goods/createRecord', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function updateGoods(params: FormGoodsType) {
  return request(`/api/v1/goods/updateRecord/${params.id}`, {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}

export async function deleteGoods(id: number) {
  return request(`/api/v1/goods/deleteRecord/${id}`, {
    method: 'DELETE',
  });
}
